﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
using static ConditionItem;

public class FlyingItemUI : MonoBehaviour
{
    public Image m_Background;
    public Text m_NameL;
    public FlyItem m_FlyItem;
    public FlyingItemList m_List;
    public Sprite m_Sprite;
    public Color m_SelectedColor;
    public Color m_SelectedTextColor;
    public Color m_UnselectColor;
    public Color m_UnselectTextColor;
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }
    public void Init(FlyItem item)
    {
        m_FlyItem = item;
        m_NameL.text = item.name;
    }

    public void OnClicked()
    {
        m_List.SelectedItem(this);
    }
    public void SetBackgroundState(BackgroundState state)
    {
        switch (state)
        {
            case BackgroundState.Unselect:
                m_Background.color = m_UnselectColor;
                m_NameL.color = m_UnselectTextColor;
                break;
            case BackgroundState.Selected:
                m_Background.color = m_SelectedColor;
                m_NameL.color = m_SelectedTextColor;
                break;
        }
    }
}